home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / layout / nsCSSProps.h < prev    next >
C/C++ Source or Header  |  2006-05-08  |  8KB  |  189 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 1998
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *   Mats Palmgren <mats.palmgren@bredband.net>
  24.  *
  25.  * Alternatively, the contents of this file may be used under the terms of
  26.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  27.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  28.  * in which case the provisions of the GPL or the LGPL are applicable instead
  29.  * of those above. If you wish to allow use of your version of this file only
  30.  * under the terms of either the GPL or the LGPL, and not to allow others to
  31.  * use your version of this file under the terms of the MPL, indicate your
  32.  * decision by deleting the provisions above and replace them with the notice
  33.  * and other provisions required by the GPL or the LGPL. If you do not delete
  34.  * the provisions above, a recipient may use your version of this file under
  35.  * the terms of any one of the MPL, the GPL or the LGPL.
  36.  *
  37.  * ***** END LICENSE BLOCK ***** */
  38. #ifndef nsCSSProps_h___
  39. #define nsCSSProps_h___
  40.  
  41. #include "nsString.h"
  42. #include "nsChangeHint.h"
  43. #include "nsCSSProperty.h"
  44. #include "nsStyleStruct.h"
  45. #include "nsCSSKeywords.h"
  46.  
  47. class nsCSSProps {
  48. public:
  49.   static void AddRefTable(void);
  50.   static void ReleaseTable(void);
  51.  
  52.   // Given a property string, return the enum value
  53.   static nsCSSProperty LookupProperty(const nsAString& aProperty);
  54.   static nsCSSProperty LookupProperty(const nsACString& aProperty);
  55.  
  56.   static inline PRBool IsShorthand(nsCSSProperty aProperty) {
  57.     NS_ASSERTION(0 <= aProperty && aProperty < eCSSProperty_COUNT,
  58.                  "out of range");
  59.     return (aProperty >= eCSSProperty_COUNT_no_shorthands);
  60.   }
  61.  
  62.   // Given a property enum, get the string value
  63.   static const nsAFlatCString& GetStringValue(nsCSSProperty aProperty);
  64.  
  65.   // Given a CSS Property and a Property Enum Value
  66.   // Return back a const nsString& representation of the 
  67.   // value. Return back nullstr if no value is found
  68.   static const nsAFlatCString& LookupPropertyValue(nsCSSProperty aProperty, PRInt32 aValue);
  69.  
  70.   // Get a color name for a predefined color value like buttonhighlight or activeborder
  71.   // Sets the aStr param to the name of the propertyID
  72.   static PRBool GetColorName(PRInt32 aPropID, nsCString &aStr);
  73.  
  74.   // Find |aKeyword| in |aTable|, if found set |aValue| to its corresponding value.
  75.   // If not found, return PR_FALSE and do not set |aValue|.
  76.   static PRBool FindKeyword(nsCSSKeyword aKeyword, const PRInt32 aTable[], PRInt32& aValue);
  77.   // Return the first keyword in |aTable| that has the corresponding value |aValue|.
  78.   // Return |eCSSKeyword_UNKNOWN| if not found.
  79.   static nsCSSKeyword ValueToKeywordEnum(PRInt32 aValue, const PRInt32 aTable[]);
  80.   // Ditto but as a string, return "" when not found.
  81.   static const nsAFlatCString& ValueToKeyword(PRInt32 aValue, const PRInt32 aTable[]);
  82.  
  83.   static const nsCSSType       kTypeTable[eCSSProperty_COUNT_no_shorthands];
  84.   static const nsStyleStructID kSIDTable[eCSSProperty_COUNT_no_shorthands];
  85.   static const PRInt32* const  kKeywordTableTable[eCSSProperty_COUNT_no_shorthands];
  86.  
  87.   // A table for shorthand properties.  The appropriate index is the
  88.   // property ID minus eCSSProperty_COUNT_no_shorthands.
  89. private:
  90.   static const nsCSSProperty *const
  91.     kSubpropertyTable[eCSSProperty_COUNT - eCSSProperty_COUNT_no_shorthands];
  92.  
  93. public:
  94.   static inline
  95.   const nsCSSProperty *const SubpropertyEntryFor(nsCSSProperty aProperty) {
  96.     NS_ASSERTION(eCSSProperty_COUNT_no_shorthands <= aProperty &&
  97.                  aProperty < eCSSProperty_COUNT,
  98.                  "out of range");
  99.     return nsCSSProps::kSubpropertyTable[aProperty -
  100.                                          eCSSProperty_COUNT_no_shorthands];
  101.   }
  102.  
  103. #define CSSPROPS_FOR_SHORTHAND_SUBPROPERTIES(iter_, prop_)                    \
  104.   for (const nsCSSProperty* iter_ = nsCSSProps::SubpropertyEntryFor(prop_);   \
  105.        *iter_ != eCSSProperty_UNKNOWN; ++iter_)
  106.  
  107.   // Keyword/Enum value tables
  108.   static const PRInt32 kAppearanceKTable[];
  109.   static const PRInt32 kAzimuthKTable[];
  110.   static const PRInt32 kBackgroundAttachmentKTable[];
  111.   static const PRInt32 kBackgroundClipKTable[];
  112.   static const PRInt32 kBackgroundColorKTable[];
  113.   static const PRInt32 kBackgroundInlinePolicyKTable[];
  114.   static const PRInt32 kBackgroundOriginKTable[];
  115.   static const PRInt32 kBackgroundRepeatKTable[];
  116.   static const PRInt32 kBackgroundXPositionKTable[];
  117.   static const PRInt32 kBackgroundYPositionKTable[];
  118.   static const PRInt32 kBorderCollapseKTable[];
  119.   static const PRInt32 kBorderColorKTable[];
  120.   static const PRInt32 kBorderStyleKTable[];
  121.   static const PRInt32 kBorderWidthKTable[];
  122.   static const PRInt32 kBoxAlignKTable[];
  123.   static const PRInt32 kBoxDirectionKTable[];
  124.   static const PRInt32 kBoxOrientKTable[];
  125.   static const PRInt32 kBoxPackKTable[];
  126. #ifdef MOZ_SVG
  127.   static const PRInt32 kDominantBaselineKTable[];
  128.   static const PRInt32 kFillRuleKTable[];
  129.   static const PRInt32 kPointerEventsKTable[];
  130.   static const PRInt32 kShapeRenderingKTable[];
  131.   static const PRInt32 kStrokeLinecapKTable[];
  132.   static const PRInt32 kStrokeLinejoinKTable[];
  133.   static const PRInt32 kTextAnchorKTable[];
  134.   static const PRInt32 kTextRenderingKTable[];
  135. #endif
  136.   static const PRInt32 kBoxPropSourceKTable[];
  137.   static const PRInt32 kBoxSizingKTable[];
  138.   static const PRInt32 kCaptionSideKTable[];
  139.   static const PRInt32 kClearKTable[];
  140.   static const PRInt32 kColorKTable[];
  141.   static const PRInt32 kContentKTable[];
  142.   static const PRInt32 kCursorKTable[];
  143.   static const PRInt32 kDirectionKTable[];
  144.   static const PRInt32 kDisplayKTable[];
  145.   static const PRInt32 kElevationKTable[];
  146.   static const PRInt32 kEmptyCellsKTable[];
  147.   static const PRInt32 kFloatKTable[];
  148.   static const PRInt32 kFloatEdgeKTable[];
  149.   static const PRInt32 kFontKTable[];
  150.   static const PRInt32 kFontSizeKTable[];
  151.   static const PRInt32 kFontStretchKTable[];
  152.   static const PRInt32 kFontStyleKTable[];
  153.   static const PRInt32 kFontVariantKTable[];
  154.   static const PRInt32 kFontWeightKTable[];
  155.   static const PRInt32 kKeyEquivalentKTable[];
  156.   static const PRInt32 kListStylePositionKTable[];
  157.   static const PRInt32 kListStyleKTable[];
  158.   static const PRInt32 kOutlineStyleKTable[];
  159.   static const PRInt32 kOutlineColorKTable[];
  160.   static const PRInt32 kOverflowKTable[];
  161.   static const PRInt32 kOverflowSubKTable[];
  162.   static const PRInt32 kPageBreakKTable[];
  163.   static const PRInt32 kPageBreakInsideKTable[];
  164.   static const PRInt32 kPageMarksKTable[];
  165.   static const PRInt32 kPageSizeKTable[];
  166.   static const PRInt32 kPitchKTable[];
  167.   static const PRInt32 kPositionKTable[];
  168.   static const PRInt32 kSpeakKTable[];
  169.   static const PRInt32 kSpeakHeaderKTable[];
  170.   static const PRInt32 kSpeakNumeralKTable[];
  171.   static const PRInt32 kSpeakPunctuationKTable[];
  172.   static const PRInt32 kSpeechRateKTable[];
  173.   static const PRInt32 kTableLayoutKTable[];
  174.   static const PRInt32 kTextAlignKTable[];
  175.   static const PRInt32 kTextDecorationKTable[];
  176.   static const PRInt32 kTextTransformKTable[];
  177.   static const PRInt32 kUnicodeBidiKTable[];
  178.   static const PRInt32 kUserFocusKTable[];
  179.   static const PRInt32 kUserInputKTable[];
  180.   static const PRInt32 kUserModifyKTable[];
  181.   static const PRInt32 kUserSelectKTable[];
  182.   static const PRInt32 kVerticalAlignKTable[];
  183.   static const PRInt32 kVisibilityKTable[];
  184.   static const PRInt32 kVolumeKTable[];
  185.   static const PRInt32 kWhitespaceKTable[];
  186. };
  187.  
  188. #endif /* nsCSSProps_h___ */
  189.